package jUnit_tests;

import static org.junit.Assert.*;
import model.Auction;
import model.Bid;
import model.Item;
import model.NonProfit;
import model.TimeObject;

import org.junit.Before;
import org.junit.Test;

import java.util.Date;

public class Junit_test_for_Item {
	Item item1;
	Item item2;
	Item item3;

	@Before
	public void setUp() throws Exception {
		Date date = new Date();
		TimeObject time1 = new TimeObject(1, 1,1);
		TimeObject time2 = new TimeObject(2, 2,2);
		NonProfit np = new NonProfit(null, null, null, null, null, null, null, null);
		Auction auction = new Auction(date, time1, time2, np);
		item1 = new Item(auction, 1);
		item2 = new Item(auction, "two", 1);
		item3 = new Item(auction, "three", "33", 1);
	}
/********  This is no longer a valid test because the files read in values
 * and the list is never empty
 * 
	@Test
	public void testEmptyList() {
		assertEquals("Empty list 1", null, item1.highestBid());
	}
	*/
	
	@Test
	public void testAddRemoveList() {
		Bid b = new Bid(item1, null, 1);
		item2.addBid(b);
		double x = item2.highestBid().getBid();
		assertEquals("Bid amount", x, 1.0, 0.01);
		item2.removeBid(b);
		assertFalse("Should be gone", item2.get_Bid_History().contains(b));
	}

}
